package com.bj58.mis.apm.server.statistics.dto.optimize;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
 * @Author: wangxw
 * @Date: 2018/10/20 13:46
 */
@ApiModel(description = "Cube调优因子")
@Data
public class SuggestFactor {
    @ApiModelProperty(value = "强制维度影响因子，总查询占比。大于等于0，小于等于1")
    private Double factorMandatory;
    @ApiModelProperty(value = "组合维度影响因子，总查询占比。大于等于0，小于等于1")
    private Double factorJoint;
    @ApiModelProperty(value = "查询统计天数。大于0")
    private Double factorDays;
    @ApiModelProperty(value = "查询次数统计衰减系数。大于等于0，小于等于1")
    private Double factorDamping;
    @ApiModelProperty(value = "聚合组计算因子。大于等于0，小于1")
    private Double factorAggregation;

    public boolean existsNullValue(){
        return factorMandatory == null || factorJoint == null || factorDays == null || factorDamping == null || factorAggregation == null;
    }

    public void setDefault(SuggestFactor sf) {
        if(factorMandatory == null) factorMandatory = sf.getFactorMandatory();
        if(factorJoint == null) factorJoint = sf.getFactorJoint();
        if(factorDays == null) factorDays = sf.getFactorDays();
        if(factorDamping == null) factorDamping = sf.getFactorDamping();
        if(factorAggregation == null) factorAggregation = sf.getFactorAggregation();
    }
}
